<?php defined('BASEPATH') or exit('No direct script access allowed');
class User_m extends MY_Model
{
	public function __construct(){
		parent::__construct();
		$this->set_table_name("user");
	}

	public  function getUserInfo($username){

		$sql = "SELECT u.username, l.*"
		." \nFROM `l_user` l INNER JOIN default_users u ON u.id = l.user_id "
		." \nWHERE  u.username = ? ";

		return $this->db->query($sql, array($username))->row();
	}

	public  function getUserInfoById($userId){

		$sql = "SELECT u.username, l.*"
		." \nFROM `l_user` l INNER JOIN default_users u ON u.id = l.user_id "
		." \nWHERE  l.user_id= ? ";

		return $this->db->query($sql, array($userId))->row();
	}

	public function searchUser($username){
		$sql = "SELECT u.username, l.*"
		." \nFROM `l_user` l INNER JOIN default_users u ON u.id = l.user_id "
		." \nWHERE  u.username= ? ";

		return $this->db->query($sql, array($username))->result();
	}
}